
import { QG_QH_DATA } from '@/enum/enum-region'

export const QG_QH_TREE_DATA = filterQhTreeData(QG_QH_DATA);

/**
 * 过滤 全国区划数据
 *
 * @param {*} treeData
 * @returns
 */
function filterQhTreeData(treeData) {
  return treeData.map(item => {
    let newItem = {
      id: item.id,
      // pId: item.parentId,
      text: item.text,
      name: item.name,
      code: item.code,
      // isLeaf: item.leaf
    };
    if (item.children) {
      newItem.children = filterQhTreeData(item.children);
    }
    return newItem;
  });
}
